#! /bin/bash

# ssh  -i id_rsa-pstam-keypair ubuntu@ec2-23-20-125-28.compute-1.amazonaws.com

# Integration a distance : appel OK, rappatriement resultats OK

# print "hello M2PGI students"
# ssh -i /home/vince/boulot/fac/2011-2012/ecom/3svn-ecom/ecom-coloc/branches/ecom/src/main/java/ecom/id_rsa-pstam-keypair ubuntu@ec2-23-20-125-28.compute-1.amazonaws.com 'source ~/.bashrc; sh hadoop-0.20.2/data/hello.sh' 

LINES=10
if [ $# -eq '1' ] ; then
	echo "un param : $1"
    LINES=$1
fi

# call to top-files : on peut lui passer un nombre de fichiers en parametre, par défaut = 10
ssh -i /home/vince/boulot/fac/2011-2012/ecom/3svn-ecom/ecom-coloc/branches/ecom/src/main/java/ecom/id_rsa-pstam-keypair ubuntu@ec2-23-20-125-28.compute-1.amazonaws.com "source ~/.bashrc; sh hadoop-0.20.2/data/top-file.sh $LINES" > result_top-files.txt

# et à distance :
# #! /bin/bash

# LINES=10
# if [ $# -eq 1 ] ; then
#         LINES=$1
# fi

# cd hadoop-0.20.2/data

# if [ -e top-files ] ; then
#         echo "Top files est a jour. $LINES premiers resultats"
#         head -n $LINES top-files

# else
#         echo "Top files n'est pas a jour : lancement de hadoop."
#         rake top-files && head -n $LINES top-files
# fi
